package com.qzc.config;


import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * 描述:
 * 分布式数据源配置
 *
 * @outhor 逆鳞雪狮
 * @create 2019-08-01 10:22
 */
@Configuration
public class DataSourceConfig {


    @Bean(name = "dataSourceOrigin")
    @ConfigurationProperties(prefix = "spring.datasource.dataorigin")
    public DataSource dataSourceOrigin(){
        // DruidXA 方式

        return DataSourceBuilder.create().build();
    }
    @Bean(name = "dataSourceTarget")
    @ConfigurationProperties(prefix = "spring.datasource.datatarget")
    public DataSource dataSourceTarget(){
        // DruidXA 方式
        return DataSourceBuilder.create().build();
    }




}
